home *** CD-ROM | disk | FTP | other *** search
- Documentation for CHKLPT.EXE and COPYLPT.EXE
-
- 1. Summaries.
-
- a. Program chklpt
-
- Usage: chklpt PRINTER
- where PRINTER is (upper, lower or mixed case)
- PRN, 1 or LPT1 for LPT1,
- 2 or LPT2 for LPT2 or
- 3 or LPT3 for LPT3.
- Returns ERRORLEVEL 0 if PRINTER is available,
- 1 if PRINTER is not available
- 100 for certain system errors.
-
-
- Program copylpt
-
- Usage: copylpt filename [PRINTER]
- where filename is file to be copied (upper, lower or mixed case)
- and optional argument PRINTER is the printer to copy to
- (upper, lower or mixed case)
- PRN, 1 or LPT1 for LPT1,
- 2 or LPT2 for LPT2 or
- 3 or LPT3 for LPT3.
- If PRINTER is not specified, copy to LPT1
- Returns ERRORLEVEL 0 if file filename was copied to the printer
- 1 if PRINTER is not available
- 2 if PRINTER is available, but file filename is
- not available.
- 3 if both PRINTER and file filename are
- available, but there was some error copying
- filename to PRINTER.
- 100 for certain system errors.
-
-
- 2. Discussion of the programs
-
- I wanted to copy the public domain file PRNTIBM.DAT from file
- PRNTIBM.ARC, which contains the high order IBM display characters, to my Epson
- FX-85 in my AUTOEXEC.BAT file. I often don't turn my printer on when I boot,
- so I didn't want to stop the batch file with DOS' standard "Abort, ignore or
- retry" prompt. These programs will let my batch file continue, but inform it
- about the printer. They require DOS 2.0 or later to run. If you try them
- under DOS 1.X, they will not give an ERRORLEVEL of 1 if PRINTER is not
- available.
-
- If either program sets ERRORLEVEL to 1, you can be quite sure that the
- printer you specified is not available. It may not exist; it may be off; it
- may be on but off-line; it may be out of paper; it may be busy; or it may have
- yet another problem. Your batch file can take whatever action you want it to.
- It can ECHO a message; it can set an environment variable which you can test
- later with an "IF %<var>%=..." command; it can pause to let you correct the
- fault; it can skip or modify programs which would normally use the printer; or
- it can do something else which fits your needs.
-
- COPYLPT can look in several directories for the file to copy. If you
- specify either a drive or a path which begins with a backslash, it merely
- looks where you say. Otherwise, it first looks in the default directory. It
- then looks in the DOS environment. If there is a variable with the same name
- as the file extension, it looks at its values for other directories with the
- same syntax as the DOS PATH command. For example, if you also wanted to copy
- C:\PDATA\PRNTIBM.DAT and C:\EPSONSET.DAT, you could set an environment
- variable DAT=c:\;c:\pdata. If it still hasn't found the file, it then looks
- in the directories specified by the DOS PATH. Finally, if you are using DOS
- 3.0 or later, it looks in the directory which contains COPYLPT.EXE.
-
- Because I wanted to use COPYLPT for a big printer set-up string, I forced
- it to copy in the binary mode, which means that it will ignore end of file
- markers and copy until it completes the file's DOS directory size.
-
-
- 3. Technical stuff.
-
- I compiled these programs with Lattice C, Version 3.10+. There are a lot
- of functions in them which may be specific to that compiler. I tried to
- describe them in the notes at the beginning of the programs, but I am not sure
- that I found them all.
-
- There are three separate functions which you may find useful for
- themselves.
-
- CHECKLPT.C contains two functions, FILE_check_lpt_available and
- handle_check_lpt_available. They use DOS function 4407H, check the status of
- an output device driver. for LPT1, LPT2 or LPT3. These functions temporarily
- take over the DOS critical error handler in case some version of DOS decides
- that opening or checking a device which doesn't exist is a critical error. I
- got the idea from a public domain CLIPPER program which I have mislaid, so I
- can not give its author proper credit.
-
- FOPEN1.C contains the function fopene_program which does all the path
- searching which I described above.
-
- YESORNO.C contains the function yesorno, which gets a non-redirectible
- response to a question.
-
-
- 4. File list for CHECKLPT.ARC
-
- Filename Comment
- -------- -----------------------------------------------------------
- CHECKLPT.C Function - is printer available?
- CHKLPT.C Source for CHKLPT.EXE
- CHKLPT.EXE Program - printer available ERRORLEVEL
- COPYLPT.C Source for COPYLPT.EXE
- COPYLPT.EXE Program - copy file to printer with availability ERRORLEVEL
- FOPEN1.C Function - extended fopen
- README This file
- YESORNO.C Function - non-redirectible yes or no
-
-
- 5. Disclaimer.
-
- I am not responsible for any bad things these programs might do. Use
- them at your own risk.
-
-
- Lew Paper
- 4/30/87